*===============================================================================
* Do-file creates "Experimental Dataset: Violence Expectations by Treatment Sample"
* Table 4
*===============================================================================
clear
set more off


cd "~/Dropbox/VFD/REStat_Native_Files/Stata_Files"
local output "~/Dropbox/VFD/REStat_Native_Files/Stata_Files/Output"

use cadg_master_NATIVE.dta, clear


*** PANEL A -- FULL SAMPLE ***

* Column 1
reghdfe cumbalance violence_34 if sample_cash_outlier==0, cl(employeenumber) ab(ym) keepsing
est store col1
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 2
reghdfe cumbalance violence_34 if sample_cash_outlier==0, cl(employeenumber) ab(ym block_final) keepsing
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 3
reghdfe cumbalance violence_34 if sample_cash_outlier==0, cl(employeenumber) ab(employeenumber ym) keepsing
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 4
reghdfe cash_savings violence_34 if sample_cash_outlier==0, cl(employeenumber) ab(ym) keepsing
est store col4
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 5
reghdfe cash_savings violence_34 if sample_cash_outlier==0, cl(employeenumber) ab(ym block_final) keepsing
est store col5
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 6
reghdfe cash_savings violence_34 if sample_cash_outlier==0, cl(employeenumber) ab(employeenumber ym) keepsing
est store col6
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

esttab col1 col2 col3 col4 col5 col6 using "`output'/table_4a.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(violence_34) ///
stats(samplestr in_sample_mean N_clust N adjR2 monthFE stratumFE individFE, fmt(0 2 0 0 2 0 0 0)  label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Strata FE" "Employee FE")) ///
label title("Experimental Dataset: Violence Expectations by Treatment Sample") replace 

*** PANEL B -- TREAT X POST ONLY  ***

* Column 1
reghdfe cumbalance violence_34 if sample_cash_outlier==0 & treat_post==1, cl(employeenumber) ab(ym) keepsing
est store col1
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Treat x Post"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 2
reghdfe cumbalance violence_34 if sample_cash_outlier==0 & treat_post==1, cl(employeenumber) ab(ym block_final) keepsing
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Treat x Post"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 3
reghdfe cumbalance violence_34 if sample_cash_outlier==0 & treat_post==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Treat x Post"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 4
reghdfe cash_savings violence_34 if sample_cash_outlier==0 & treat_post==1, cl(employeenumber) ab(ym) keepsing
est store col4
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Treat x Post"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 5
reghdfe cash_savings violence_34 if sample_cash_outlier==0 & treat_post==1, cl(employeenumber) ab(ym block_final) keepsing
est store col5
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Treat x Post"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 6
reghdfe cash_savings violence_34 if sample_cash_outlier==0 & treat_post==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col6
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Treat x Post"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

esttab col1 col2 col3 col4 col5 col6 using "`output'/table_4b.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(violence_34) ///
stats(samplestr in_sample_mean N_clust N adjR2 monthFE stratumFE individFE, fmt(0 2 0 0 2 0 0 0)  label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Strata FE" "Employee FE")) ///
label title("Experimental Dataset: Violence Expectations by Treatment Sample") replace 


*** PANEL C -- CONTROL GROUP ONLY ***

* Column 1
reghdfe cumbalance violence_34 if sample_cash_outlier==0 & treat_final==0, cl(employeenumber) ab(ym) keepsing
est store col1
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Control"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 2
reghdfe cumbalance violence_34 if sample_cash_outlier==0 & treat_final==0, cl(employeenumber) ab(ym block_final) keepsing
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Control"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 3
reghdfe cumbalance violence_34 if sample_cash_outlier==0 & treat_final==0, cl(employeenumber) ab(employeenumber ym) keepsing
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Control"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 4
reghdfe cash_savings violence_34 if sample_cash_outlier==0 & treat_final==0, cl(employeenumber) ab(ym) keepsing
est store col4
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Control"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 5
reghdfe cash_savings violence_34 if sample_cash_outlier==0 & treat_final==0, cl(employeenumber) ab(ym block_final) keepsing
est store col5
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Control"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 6
reghdfe cash_savings violence_34 if sample_cash_outlier==0 & treat_final==0, cl(employeenumber) ab(employeenumber ym) keepsing
est store col6
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "Control"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

esttab col1 col2 col3 col4 col5 col6 using "`output'/table_4c.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(violence_34) ///
stats(samplestr in_sample_mean N_clust N adjR2 monthFE stratumFE individFE, fmt(0 2 0 0 2 0 0 0)  label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Strata FE" "Employee FE")) ///
label title("Experimental Dataset: Violence Expectations by Treatment Sample") replace 


